package com.wing.productionPlan.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 生产报工单
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_production_the_work_order")
public class ProductionTheWorkOrder extends BaseEntity<ProductionTheWorkOrder> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {
        
        tosubmit(0,"待提交"),

        confirm(1,"已提交"),
        
        checked(2,"已审核"),

        sendOver(3,"送检完成"),

        confirmed(4,"已确认"),

        pieceRateConfirmed(5,"已计件工资确认"),

        toSettle(6,"待结算"),

        settled(7,"已结算");


        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum CheckStatus implements IEnum<Integer> {

        /**
        * 审核相符
        */
        correspond(0,"审核相符"),
        /**
        * 审核不符
        */
        discrepancy(1,"审核不符");

        private int code;
        private String desc;

        CheckStatus(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * day
     */
    private Integer day;

    /**
     * no
     */
    private Integer no;

    /**
     * 不合格数
     */
    private Integer qualifiedNoQuantity;

    /**
     * 企业编号
     */
    private String enterpriseCode;

    /**
     * 报工单编码
     */
    private String code;

    /**
     * 开工单id
     */
    private Long workOrderId;

    /**
     * 工序id
     */
    private Long processId;

    /**
     * 工序名称
     */
    private String processName;

    /**
     * 生产计划id
     */
    private Long productionPlanId;

    /**
     * 设备编码
     */
    private String deviceCode;

    /**
     * 设备型号
     */
    private String deviceModel;

    /**
    * 开始时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 车间id
     */
    private Long workshopId;

    /**
     * 车间
     */
    private String workshopName;

    /**
     * 报工数量
     */
    private Integer workQuantity;

    /**
     * 质检数量
     */
    private Integer qualityQuantity;

    /**
     * 已送检数
     */
    private Integer sendQuantity;

    /**
     * 计件工资
     */
    private BigDecimal pieceRate;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 审核状态
     */
    private CheckStatus checkStatus;

    /**
    * 审核状态描述
    */
    @TableField(exist = false)
    private String checkStatusDesc;

    public String getCheckStatusDesc() {
        return checkStatus == null ? null : checkStatus.getDesc();
    }


    /**
     * 报工图片
     */
    private String reportWorkPic;

    /**
     * 仓库类型
     */
    private Long warehouseTypeId;

    /**
     * 入库仓库
     */
    private Long warehouseId;

    /**
     * 自检状态
     */
    private String reportWorkCheckStatus;

    /**
     * 工种、设备id
     */
    private Long gzsbId;

    /**
     * 工位性质
     */
    private String workstationNature;


}
